package genetic.q3.functions.math;

import genetic.Function;
import genetic.TreeNode;
import genetic.q3.functions.Computable;
import genetic.q3.functions.SymbolicRegressionFunction;

public class ulp extends SymbolicRegressionFunction{

	public ulp() {
		super(null);
	}
	
	public ulp(TreeNode[] kids) {
		super(kids);
	}

	@Override
	public Function createInstance(TreeNode[] kids) {
		return new ulp(kids);
	}

	@Override
	public TreeNode createRandomInstance(TreeNode[] kids) {
		return new ulp(kids);
	}

	@Override
	public int getNumKids() {
		return 1;
	}

	@Override
	public String getName() {
		return "ulp";
	}

	@Override
	public double compute(double xVal) {
		double val1 = ((Computable)kids[0]).compute(xVal);
		return Math.ulp(val1);
	}
}
